package city.spring.modules.oldman.vo;

import city.spring.action.model.AbstractComplaintReceiver;
import city.spring.modules.oldman.entity.ComplaintReceiverExtEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @author pxm
 * @date 2020/6/4 0004 16:48
 * @see ComplaintReceiverExtEntity
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class ComplaintReceiverExtVO extends ComplaintReceiverExtEntity {
    /**
     * 人员名称
     */
    private String name;

    /**
     * 部门名称
     */
    private String orgName;

    /**
     * 岗位名称
     */
    private String jobName;

    /**
     * 手机号
     */
    private String telPhone;

    /**
     * 转换成所需要的对象
     *
     * @return AbstractComplaintReceiver
     */
    public AbstractComplaintReceiver<ComplaintReceiverExtVO> toComplaintReceiver() {
        ComplaintReceiverExtVO item = this;
        return new AbstractComplaintReceiver<ComplaintReceiverExtVO>() {

            @Override
            public Object getKey() {
                return item.getReceiverId();
            }

            @Override
            public String getName() {
                return item.getName();
            }

            @Override
            public String getOrgName() {
                return item.getOrgName();
            }

            @Override
            public String getJob() {
                return item.getJobName();
            }

            @Override
            public String getTelPhone() {
                return item.getTelPhone();
            }

            @Override
            public ComplaintReceiverExtVO getObject() {
                return item;
            }
        };
    }
}
